﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Specification
{
    public abstract class Or<T> : CompositeSpecification<T>
    {
        public Or(ISpecification<T> LeftSpecification, ISpecification<T> RightSpecification)
        {
            List<ISpecification<T>> Specifications = new List<ISpecification<T>>();
            Specifications.Add(LeftSpecification);
            Specifications.Add(RightSpecification);
            this._Specifications = Specifications;
        }
        public override bool isSatisfiedBy(T objekt)
        {
            return this._Specifications.ElementAt(0).isSatisfiedBy(objekt) || this._Specifications.ElementAt(1).isSatisfiedBy(objekt);
        }
    }
}
